package com.itheima.controller;

import com.itheima.entity.Result;
import com.itheima.pojo.SysDictData;
import com.itheima.service.SysDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author xuchangshuo
 * @date 2020/8/4 19:40
 */
@CrossOrigin
@RestController
@RequestMapping("/sysDictData")
public class SysDictDataController {

    @Autowired
    private SysDictDataService sysDictDataService;

    @RequestMapping("/getListByDictType")
    public Result getListByDictType(String dictType) {
        List<SysDictData> listByDictType = sysDictDataService.getListByDictType(dictType);
        return new Result("success", listByDictType);
    }

    @RequestMapping("/getListByDictTypeList")
    public Result getListByDictTypeList(String[] dictTypes) {
        List<SysDictData> listByDictTypeList = sysDictDataService.getListByDictTypeList(dictTypes);
        return new Result("success", listByDictTypeList);

    }
}
